//
//  SetTabHeadFootView.swift
//  OneMeeting
//
//  Created by zhangheng on 2019/8/28.
//  Copyright © 2019 www.zhangheng.com. All rights reserved.
//

import Foundation

enum SetHeadFootType {
    case head
    case foot
}

class SetTabHeadFootView: NSTableCellView {
    
    var type:SetHeadFootType = SetHeadFootType.head
    
    override init(frame frameRect: NSRect) {
        super.init(frame: frameRect)
    }
    
    convenience init(_ type:SetHeadFootType) {
        self.init()
        self.type = type
        setupUI()
        
    }
    
    override func draw(_ dirtyRect: NSRect) {
        super.draw(dirtyRect)
    }
    
    required init?(coder decoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    lazy var title: NSLabel = {
        let tef = NSLabel.label(title: "关于壹会通:", textColor: NSColor.black, font: NSFont.systemFont(ofSize: 16))
        tef.sizeToFit()
        return tef
    }()
    
    lazy var upgrBtn: LLCustomBtn = {
        let btn = LLCustomBtn()
        btn.defaultTitle = "检查更新".localized()
        btn.defaultFont = NSFont.systemFont(ofSize: 11)
        btn.textAlignment = LLTextAlignmentCenter
        btn.defaultBackgroundColor = NSColor.white
        btn.zh_border(radius: 12, borderColor: color_gray(210), borderWidth: 1)
        btn.isHandCursor = true
        btn.target = self
        btn.action = #selector(upgrBtnAction(senber:))
        return btn
    }()
    
    @objc func upgrBtnAction(senber:NSButton ) -> () {
        self.jk_viewcontroller()?.view.makeToast(message: "最新版")
    }
    
    func setupUI() -> () {
        self.addSubview(upgrBtn)
        upgrBtn.snp.makeConstraints { (make) in
            make.width.equalTo(120)
            make.height.equalTo(24)
            make.left.equalTo(30)
            make.bottom.equalToSuperview().offset(-15)
        }
        
        self.addSubview(title)
        title.snp.makeConstraints { (make) in
            make.height.equalTo(20)
            make.left.equalTo(20)
            make.top.equalTo(20)
        }
    }
    

}
